<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <link th:href="@{/css/semantic.min.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/layui/layui.js}"></script>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script th:src="@{/js/jquery-3.1.1.min.js}"></script>
    <script th:src="@{/js/semantic.min.js}">
    </script>
</head>
<body>
<!--菜单-->
<ul class="layui-nav layui-bg-blue" lay-filter="">
    <li class="layui-nav-item "><a href="/" style="font-size: 20px">首页</a></li>
    <li class="layui-nav-item layui-this">
        <a href="javascript:;" style="font-size: 20px">习题库</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/item/chapter/overview}">分章节练习</a>
            </dd>
            <dd>
                <a th:href="@{/item/overview}">分题型练习</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item">
        <a href="javascript:;" style="font-size: 20px">课程分类</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{'/course/type_show/'+${coursetype.getId()}}" th:each="coursetype:${coursetypes}" th:text="${coursetype.getCourse_name()}"></a>
            </dd>
            <dd>
                <a th:href="@{/course/type_show/0}" >全部课程</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} == null"><a th:href="@{/community/index}" style="font-size: 20px">社区</a></li>
    <li class="layui-nav-item " th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">社区</a>
        <dl class="layui-nav-child">
            <dd><a th:href="@{/community/index}">社区首页</a></dd>
            <dd><a th:href="@{/stu/community/commenting}">发布话题</a></dd>
            <dd><a th:href="@{/stu/community/management}">我的话题</a></dd>
            <dd><a th:href="@{/stu/chat_all}" target="_blank">头脑风暴</a></dd>
        </dl>
    </li>
    <li class="layui-nav-item"><a th:href="@{/file/list}" style="font-size: 20px">资料干货</a></li>

    <!--如果没有登录-->
    <li class="layui-nav-item" th:if="${session.loginuser} == null">
        <a th:href="@{/login}" style="font-size: 20px">登录</a>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} == null">
        <a th:href="@{/register}" style="font-size: 20px">注册</a>
    </li>
    <!--如果没有登录-->

    <!--如果登录-->
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">我的班级</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/stu/map/show}">班级签到</a>
            </dd>
            <dd>
                <a th:href="@{/stu/exam/overview}">班级考试</a>
            </dd>
            <dd>
                <a th:href="@{/stu/exam/mydegree/list}">我的考试成绩</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">好友管理</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/stu/friends/list}">好友列表</a>
            </dd>
            <dd>
                <a th:href="@{/stu/friends/search}">搜索好友</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <img th:src="@{'/show/'+${session.loginuser.getId()}}" class="layui-nav-img">[[${session.loginuser.username}]]
        <dl class="layui-nav-child">
            <dd><a th:href="@{/stu/center}">个人中心</a></dd>
            <dd><a th:href="@{/stu/logout}">退出</a></dd>
        </dl>
    </li>

    <!--如果登录-->
</ul>
<!--菜单-->

<!--分割线-->
<h2 class="ui center aligned blue icon header">
    <i class="circular student icon"></i>
    答案及解析
</h2>
<!--分割线-->

<!--选项框-->
<div class="layui-tab">
    <ul class="layui-tab-title" >
        <li class="layui-this" >答案及解析</li>
    </ul>

    <div class="layui-tab-content" >
        <!--        内容-->
        <div class="layui-tab-item layui-show" >
            <div class="ui container" th:each="result:${myitemresults}">
                <div class="ui segment">
                    <h3 class="ui blue header" th:text="${'题目：'+result.getExam().getSubject()}"></h3>
                    <form  method="post"  class="layui-form" >
                        <br>
                        <div class="layui-form-item" th:if="${result.getExam().getType_id()==1||result.getExam().getType_id()==2}">
                            <div class="layui-input-block">
                                <label  class="ui label"   th:text="'A:'+${result.getExam().getAnswer_a()}"/>
                            </div>
                        </div>

                        <div class="layui-form-item" th:if="${result.getExam().getType_id()==1||result.getExam().getType_id()==2}">
                            <div class="layui-input-block">
                                <label   class="ui label"  th:text="'B:'+${result.getExam().getAnswer_b()}"/>
                            </div>
                        </div>

                        <div class="layui-form-item" th:if="${result.getExam().getType_id()==1||result.getExam().getType_id()==2}">
                            <div class="layui-input-block">
                                <label   class="ui label"  th:text="'C:'+${result.getExam().getAnswer_c()}"/>
                            </div>
                        </div>

                        <div class="layui-form-item" th:if="${result.getExam().getType_id()==1||result.getExam().getType_id()==2}">
                            <div class="layui-input-block">
                                <label  class="ui label"   th:text="'D:'+${result.getExam().getAnswer_d()}"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <h5 class="ui blue header" th:text="'我的回答：'+${result.getMyresult()}"></h5>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <h5 class="ui blue header" th:text="'答案：'+${result.getExam().getAnswer_true()}"></h5>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <h5 class="ui blue header" th:text="'解析：'+${result.getExam().getDescription()}"></h5>
                            </div>
                        </div>
                        <br>
                        <div id="buttonsuccess" class="ui orange  button" th:onclick="|putin_errorbook(${result.getExam().getId()})|" th:if="${session.loginuser} != null">加入错题本</div>
                        <br>
                    </form>
                </div>
            </div>
        </div>
        <!--        内容-->
    </div>
</div>
<!--选项框-->
</body>
<script>

    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //…
    });

    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });

    //加入错题本
    function putin_errorbook(id)
    {
        console.log(id);
        $.post(
            '/stu/item/putin_errorbook',
            {'id':id},
            function (result) {

            }
        );
    }

    $(document).ready(function(){
        $('.ui.orange.button').click(function () {
            $(this).text('加入成功');
            $(this).removeClass("ui orange button");
            $(this).addClass("ui positive button");
        })
    });
</script>
</html>